cmake_minimum_required(VERSION 3.10)
project(PrimeCore)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenMP REQUIRED)

include_directories(include)

add_library(PrimeCore SHARED src/PrimeCore.cpp)

target_link_libraries(PrimeCore PUBLIC OpenMP::OpenMP_CXX)

set_target_properties(PrimeCore PROPERTIES
    POSITION_INDEPENDENT_CODE ON
    CXX_VISIBILITY_PRESET hidden
    VISIBILITY_INLINES_HIDDEN ON
)

if(MSVC)
    target_compile_options(PrimeCore PRIVATE /O2 /fp:fast)
else()
    target_compile_options(PrimeCore PRIVATE -O3 -march=native -ffast-math)
endif()